home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  56.2 KB  |  1,567 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __MACWINDOWS__
  18. #define __MACWINDOWS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __ALIASES__
  24. #include <Aliases.h>
  25. #endif
  26. #ifndef __APPLEEVENTS__
  27. #include <AppleEvents.h>
  28. #endif
  29. #ifndef __COLLECTIONS__
  30. #include <Collections.h>
  31. #endif
  32. #ifndef __DRAG__
  33. #include <Drag.h>
  34. #endif
  35. #ifndef __EVENTS__
  36. #include <Events.h>
  37. #endif
  38. #ifndef __MENUS__
  39. #include <Menus.h>
  40. #endif
  41. #ifndef __MIXEDMODE__
  42. #include <MixedMode.h>
  43. #endif
  44. #ifndef __QDOFFSCREEN__
  45. #include <QDOffscreen.h>
  46. #endif
  47. #ifndef __QUICKDRAW__
  48. #include <Quickdraw.h>
  49. #endif
  50. #ifndef __TEXTCOMMON__
  51. #include <TextCommon.h>
  52. #endif
  53. #ifndef __ICONS__
  54. #include <Icons.h>
  55. #endif
  56.  
  57.  
  58.  
  59.  
  60. #if PRAGMA_ONCE
  61. #pragma once
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67.  
  68. #if PRAGMA_IMPORT
  69. #pragma import on
  70. #endif
  71.  
  72. #if PRAGMA_STRUCT_ALIGN
  73.     #pragma options align=mac68k
  74. #elif PRAGMA_STRUCT_PACKPUSH
  75.     #pragma pack(push, 2)
  76. #elif PRAGMA_STRUCT_PACK
  77.     #pragma pack(2)
  78. #endif
  79.  
  80. /*——————————————————————————————————————————————————————————————————————————————————————*/
  81. /* • Property Types (Mac OS 8.5 and later)                                                */
  82. /*——————————————————————————————————————————————————————————————————————————————————————*/
  83. typedef OSType                             PropertyCreator;
  84. typedef OSType                             PropertyTag;
  85. /*——————————————————————————————————————————————————————————————————————————————————————*/
  86. /* • Window Classes (Mac OS 8.5 and later)                                                */
  87. /*——————————————————————————————————————————————————————————————————————————————————————*/
  88. typedef UInt32                             WindowClass;
  89.  
  90. enum {
  91.     kAlertWindowClass            = 1L,                            /* “I need your attention now.”*/
  92.     kMovableAlertWindowClass    = 2L,                            /* “I need your attention now, but I’m kind enough to let you switch out of this app to do other things.”*/
  93.     kModalWindowClass            = 3L,                            /* system modal, not draggable*/
  94.     kMovableModalWindowClass    = 4L,                            /* application modal, draggable*/
  95.     kFloatingWindowClass        = 5L,                            /* floats above all other application windows*/
  96.     kDocumentWindowClass        = 6L                            /* everything else*/
  97. };
  98.  
  99.  
  100. /*——————————————————————————————————————————————————————————————————————————————————————*/
  101. /* • Window Attributes (Mac OS 8.5 and later)                                            */
  102. /*——————————————————————————————————————————————————————————————————————————————————————*/
  103.  
  104. typedef UInt32                             WindowAttributes;
  105.  
  106. enum {
  107.     kWindowNoAttributes            = 0L,                            /* no attributes*/
  108.     kWindowCloseBoxAttribute    = (1L << 0),                    /* window has a close box*/
  109.     kWindowHorizontalZoomAttribute = (1L << 1),                    /* window has horizontal zoom box*/
  110.     kWindowVerticalZoomAttribute = (1L << 2),                    /* window has vertical zoom box*/
  111.     kWindowFullZoomAttribute    = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
  112.     kWindowCollapseBoxAttribute    = (1L << 3),                    /* window has a collapse box*/
  113.     kWindowResizableAttribute    = (1L << 4),                    /* window is resizable*/
  114.     kWindowSideTitlebarAttribute = (1L << 5),                    /* window wants a titlebar on the side    (floating window class only)*/
  115.     kWindowNoUpdatesAttribute    = (1L << 16),                    /* this window receives no update events*/
  116.     kWindowNoActivatesAttribute    = (1L << 17),                    /* this window receives no activate events*/
  117.     kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
  118.     kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
  119. };
  120.  
  121.  
  122. /*——————————————————————————————————————————————————————————————————————————————————————*/
  123. /* • Errors & Gestalt (Mac OS 8.5 and later)                                            */
  124. /*——————————————————————————————————————————————————————————————————————————————————————*/
  125.  
  126. enum {
  127.     gestaltWindowMgrAttr        = FOUR_CHAR_CODE('wind'),        /* If this Gestalt exists, the Mac OS 8.5 Window Manager is installed*/
  128.     gestaltWindowMgrPresent        = (1L << 0)
  129. };
  130.  
  131.  
  132.  
  133. enum {
  134.     errInvalidWindowPtr            = -5600,                        /* tried to pass a bad WindowPtr argument*/
  135.     errUnsupportedWindowAttributesForClass = -5601,                /* tried to create a window with WindowAttributes not supported by the WindowClass*/
  136.     errWindowDoesNotHaveProxy    = -5602,                        /* tried to do something requiring a proxy to a window which doesn’t have a proxy*/
  137.     errInvalidWindowProperty    = -5603,                        /* tried to access a property tag with private creator*/
  138.     errWindowPropertyNotFound    = -5604,                        /* tried to get a nonexistent property*/
  139.     errUnrecognizedWindowClass    = -5605,                        /* tried to create a window with a bad WindowClass*/
  140.     errCorruptWindowDescription    = -5606,                        /* tried to load a corrupt window description (size or version fields incorrect)*/
  141.     errUserWantsToDragWindow    = -5607,                        /* if returned from TrackWindowProxyDrag, you should call DragWindow on the window*/
  142.     errWindowsAlreadyInitialized = -5608,                        /* tried to call InitFloatingWindows twice, or called InitWindows and then floating windows*/
  143.     errFloatingWindowsNotInitialized = -5609                    /* called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows*/
  144. };
  145.  
  146.  
  147.  
  148. /*——————————————————————————————————————————————————————————————————————————————————————*/
  149. /* • Window Definition Type                                                                */
  150. /*——————————————————————————————————————————————————————————————————————————————————————*/
  151.  
  152. enum {
  153.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  154. };
  155.  
  156. /*——————————————————————————————————————————————————————————————————————————————————————*/
  157. /* • Mac OS 7.5 Window Definition Resource IDs                                            */
  158. /*——————————————————————————————————————————————————————————————————————————————————————*/
  159.  
  160. enum {
  161.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  162.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  163.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  164. };
  165.  
  166. /*——————————————————————————————————————————————————————————————————————————————————————*/
  167. /* • Variant Codes                                                                        */
  168. /*——————————————————————————————————————————————————————————————————————————————————————*/
  169.  
  170. enum {
  171.                                                                 /* for use with kStandardWindowDefinition */
  172.     kDocumentWindowVariantCode    = 0,
  173.     kModalDialogVariantCode        = 1,
  174.     kPlainDialogVariantCode        = 2,
  175.     kShadowDialogVariantCode    = 3,
  176.     kMovableModalDialogVariantCode = 5,
  177.     kAlertVariantCode            = 7,
  178.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  179.     kSideFloaterVariantCode        = 8
  180. };
  181.  
  182.  
  183. /*——————————————————————————————————————————————————————————————————————————————————————*/
  184. /* • DefProc IDs                                                                        */
  185. /*——————————————————————————————————————————————————————————————————————————————————————*/
  186.  
  187. enum {
  188.                                                                 /* classic ids */
  189.     documentProc                = 0,
  190.     dBoxProc                    = 1,
  191.     plainDBox                    = 2,
  192.     altDBoxProc                    = 3,
  193.     noGrowDocProc                = 4,
  194.     movableDBoxProc                = 5,
  195.     zoomDocProc                    = 8,
  196.     zoomNoGrow                    = 12,
  197.     rDocProc                    = 16,                            /* floating window defproc ids */
  198.     floatProc                    = 1985,
  199.     floatGrowProc                = 1987,
  200.     floatZoomProc                = 1989,
  201.     floatZoomGrowProc            = 1991,
  202.     floatSideProc                = 1993,
  203.     floatSideGrowProc            = 1995,
  204.     floatSideZoomProc            = 1997,
  205.     floatSideZoomGrowProc        = 1999
  206. };
  207.  
  208.  
  209. enum {
  210.                                                                 /* Resource IDs for theme-savvy window defprocs */
  211.     kWindowDocumentDefProcResID    = 64,
  212.     kWindowDialogDefProcResID    = 65,
  213.     kWindowUtilityDefProcResID    = 66,
  214.     kWindowUtilitySideTitleDefProcResID = 67
  215. };
  216.  
  217.  
  218. enum {
  219.                                                                 /* Proc IDs for theme-savvy windows */
  220.     kWindowDocumentProc            = 1024,
  221.     kWindowGrowDocumentProc        = 1025,
  222.     kWindowVertZoomDocumentProc    = 1026,
  223.     kWindowVertZoomGrowDocumentProc = 1027,
  224.     kWindowHorizZoomDocumentProc = 1028,
  225.     kWindowHorizZoomGrowDocumentProc = 1029,
  226.     kWindowFullZoomDocumentProc    = 1030,
  227.     kWindowFullZoomGrowDocumentProc = 1031
  228. };
  229.  
  230.  
  231. enum {
  232.                                                                 /* Proc IDs for theme-savvy dialogs */
  233.     kWindowPlainDialogProc        = 1040,
  234.     kWindowShadowDialogProc        = 1041,
  235.     kWindowModalDialogProc        = 1042,
  236.     kWindowMovableModalDialogProc = 1043,
  237.     kWindowAlertProc            = 1044,
  238.     kWindowMovableAlertProc        = 1045
  239. };
  240.  
  241.  
  242. enum {
  243.                                                                 /* procIDs available in Mac OS 8.1 (Appearance 1.0.1) or later */
  244.     kWindowMovableModalGrowProc    = 1046
  245. };
  246.  
  247.  
  248. enum {
  249.                                                                 /* Proc IDs for top title bar theme-savvy floating windows */
  250.     kWindowFloatProc            = 1057,
  251.     kWindowFloatGrowProc        = 1059,
  252.     kWindowFloatVertZoomProc    = 1061,
  253.     kWindowFloatVertZoomGrowProc = 1063,
  254.     kWindowFloatHorizZoomProc    = 1065,
  255.     kWindowFloatHorizZoomGrowProc = 1067,
  256.     kWindowFloatFullZoomProc    = 1069,
  257.     kWindowFloatFullZoomGrowProc = 1071
  258. };
  259.  
  260.  
  261.  
  262. enum {
  263.                                                                 /* Proc IDs for side title bar theme-savvy floating windows */
  264.     kWindowFloatSideProc        = 1073,
  265.     kWindowFloatSideGrowProc    = 1075,
  266.     kWindowFloatSideVertZoomProc = 1077,
  267.     kWindowFloatSideVertZoomGrowProc = 1079,
  268.     kWindowFloatSideHorizZoomProc = 1081,
  269.     kWindowFloatSideHorizZoomGrowProc = 1083,
  270.     kWindowFloatSideFullZoomProc = 1085,
  271.     kWindowFloatSideFullZoomGrowProc = 1087
  272. };
  273.  
  274. /*——————————————————————————————————————————————————————————————————————————————————————*/
  275. /* • System 7 Window Positioning Constants                                                */
  276. /*                                                                                        */
  277. /* Passed into StandardAlert and used in ‘WIND’, ‘DLOG’, and ‘ALRT’ templates            */
  278. /* StandardAlert uses zero to specify the default position. Other calls use zero to        */
  279. /* specify “no position”.  Do not pass these constants to RepositionWindow.  Do not        */
  280. /* store these constants in the BasicWindowDescription of a ‘wind’ resource.            */
  281. /*——————————————————————————————————————————————————————————————————————————————————————*/
  282.  
  283.  
  284. enum {
  285.     kWindowNoPosition            = 0x0000,
  286.     kWindowDefaultPosition        = 0x0000,                        /* used by StandardAlert*/
  287.     kWindowCenterMainScreen        = 0x280A,
  288.     kWindowAlertPositionMainScreen = 0x300A,
  289.     kWindowStaggerMainScreen    = 0x380A,
  290.     kWindowCenterParentWindow    = 0xA80A,
  291.     kWindowAlertPositionParentWindow = 0xB00A,
  292.     kWindowStaggerParentWindow    = 0xB80A,
  293.     kWindowCenterParentWindowScreen = 0x680A,
  294.     kWindowAlertPositionParentWindowScreen = 0x700A,
  295.     kWindowStaggerParentWindowScreen = 0x780A
  296. };
  297.  
  298.  
  299. /*——————————————————————————————————————————————————————————————————————————————————————*/
  300. /* • Window Positioning Methods    (Mac OS 8.5 and later)                                    */
  301. /*                                                                                        */
  302. /* Positioning methods passed to RepositionWindow.                                        */
  303. /* Do not use them in WIND, ALRT, DLOG templates.                                          */
  304. /* Do not confuse these constants with the constants above                                */
  305. /*——————————————————————————————————————————————————————————————————————————————————————*/
  306. typedef UInt32                             WindowPositionMethod;
  307.  
  308. enum {
  309.     kWindowCenterOnMainScreen    = 0x00000001,
  310.     kWindowCenterOnParentWindow    = 0x00000002,
  311.     kWindowCenterOnParentWindowScreen = 0x00000003,
  312.     kWindowCascadeOnMainScreen    = 0x00000004,
  313.     kWindowCascadeOnParentWindow = 0x00000005,
  314.     kWIndowCascadeOnParentWindowScreen = 0x00000006,
  315.     kWindowAlertPositionOnMainScreen = 0x00000007,
  316.     kWindowAlertPositionOnParentWindow = 0x00000008,
  317.     kWindowAlertPositionOnParentWindowScreen = 0x00000009
  318. };
  319.  
  320.  
  321. /*——————————————————————————————————————————————————————————————————————————————————————*/
  322. /* • GetWindowRegion Types                                                                */
  323. /*——————————————————————————————————————————————————————————————————————————————————————*/
  324.  
  325.  
  326. enum {
  327.                                                                 /* Region values to pass into GetWindowRegion */
  328.     kWindowTitleBarRgn            = 0,
  329.     kWindowTitleTextRgn            = 1,
  330.     kWindowCloseBoxRgn            = 2,
  331.     kWindowZoomBoxRgn            = 3,
  332.     kWindowDragRgn                = 5,
  333.     kWindowGrowRgn                = 6,
  334.     kWindowCollapseBoxRgn        = 7,
  335.     kWindowTitleProxyIconRgn    = 8,                            /* Mac OS 8.5 and later*/
  336.     kWindowStructureRgn            = 32,
  337.     kWindowContentRgn            = 33
  338. };
  339.  
  340.  
  341. typedef UInt16                             WindowRegionCode;
  342. /* GetWindowRegionRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion*/
  343.  
  344. struct GetWindowRegionRec {
  345.     RgnHandle                         winRgn;
  346.     WindowRegionCode                 regionCode;
  347. };
  348. typedef struct GetWindowRegionRec        GetWindowRegionRec;
  349.  
  350. typedef GetWindowRegionRec *            GetWindowRegionPtr;
  351. typedef GetWindowRegionRec *            GetWindowRegionRecPtr;
  352. /*——————————————————————————————————————————————————————————————————————————————————————*/
  353. /* • WDEF Message Types (Mac OS 8.5 and later)                                            */
  354. /*——————————————————————————————————————————————————————————————————————————————————————*/
  355. /*
  356.    SetupWindowProxyDragImageRec - setup the proxy icon drag image
  357.    Both regions are allocated and disposed by the Window Manager.
  358.    The GWorld is disposed of by the Window Manager, but the WDEF must allocate
  359.    it.  See Technote on Drag Manager 1.1 additions for more information and sample code for
  360.    setting up drag images.
  361. */
  362.  
  363.  
  364. struct SetupWindowProxyDragImageRec {
  365.     GWorldPtr                         imageGWorld;                /* locked GWorld containing the drag image - output - can be NULL*/
  366.     RgnHandle                         imageRgn;                    /* image clip region, contains the portion of the image which gets blitted to screen - preallocated output - if imageGWorld is NULL, this is ignored*/
  367.     RgnHandle                         outlineRgn;                    /* the outline region used on shallow monitors - preallocated output - must always be non-empty*/
  368. };
  369. typedef struct SetupWindowProxyDragImageRec SetupWindowProxyDragImageRec;
  370. /* MeasureWindowTitleRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion*/
  371.  
  372. struct MeasureWindowTitleRec {
  373.                                                                 /* output parameters*/
  374.     SInt16                             fullTitleWidth;                /* text + proxy icon width*/
  375.     SInt16                             titleTextWidth;                /* text width*/
  376.  
  377.                                                                 /* input parameters*/
  378.     Boolean                         isUnicodeTitle;
  379.     Boolean                         unused;                        /* future use*/
  380. };
  381. typedef struct MeasureWindowTitleRec    MeasureWindowTitleRec;
  382. typedef MeasureWindowTitleRec *            MeasureWindowTitleRecPtr;
  383. /*——————————————————————————————————————————————————————————————————————————————————————*/
  384. /* • Standard Window Kinds                                                                */
  385. /*——————————————————————————————————————————————————————————————————————————————————————*/
  386.  
  387. enum {
  388.     dialogKind                    = 2,
  389.     userKind                    = 8,
  390.     kDialogWindowKind            = 2,
  391.     kApplicationWindowKind        = 8
  392. };
  393.  
  394.  
  395. /*——————————————————————————————————————————————————————————————————————————————————————*/
  396. /* • FindWindow Result Codes                                                            */
  397. /*——————————————————————————————————————————————————————————————————————————————————————*/
  398.  
  399. enum {
  400.     inDesk                        = 0,
  401.     inNoWindow                    = 0,
  402.     inMenuBar                    = 1,
  403.     inSysWindow                    = 2,
  404.     inContent                    = 3,
  405.     inDrag                        = 4,
  406.     inGrow                        = 5,
  407.     inGoAway                    = 6,
  408.     inZoomIn                    = 7,
  409.     inZoomOut                    = 8,
  410.     inCollapseBox                = 11,                            /* Mac OS 8.0 and later*/
  411.     inProxyIcon                    = 12                            /* Mac OS 8.5 and later*/
  412. };
  413.  
  414.  
  415. /*——————————————————————————————————————————————————————————————————————————————————————*/
  416. /* • Window Definition Hit Test Result Codes                                            */
  417. /*——————————————————————————————————————————————————————————————————————————————————————*/
  418.  
  419. enum {
  420.     wNoHit                        = 0,
  421.     wInContent                    = 1,
  422.     wInDrag                        = 2,
  423.     wInGrow                        = 3,
  424.     wInGoAway                    = 4,
  425.     wInZoomIn                    = 5,
  426.     wInZoomOut                    = 6,
  427.     wInCollapseBox                = 9,                            /* Mac OS 8.0 and later*/
  428.     wInProxyIcon                = 10                            /* Mac OS 8.5 and later*/
  429. };
  430.  
  431.  
  432. /*——————————————————————————————————————————————————————————————————————————————————————*/
  433. /* • Window Definition Messages                                                            */
  434. /*——————————————————————————————————————————————————————————————————————————————————————*/
  435.  
  436.  
  437. enum {
  438.     kWindowMsgDraw                = 0,
  439.     kWindowMsgHitTest            = 1,
  440.     kWindowMsgCalculateShape    = 2,
  441.     kWindowMsgInitialize        = 3,
  442.     kWindowMsgCleanUp            = 4,
  443.     kWindowMsgDrawGrowOutline    = 5,
  444.     kWindowMsgDrawGrowBox        = 6
  445. };
  446.  
  447. /* Messages available in Mac OS 8.0 and later*/
  448.  
  449. enum {
  450.     kWindowMsgGetFeatures        = 7,
  451.     kWindowMsgGetRegion            = 8
  452. };
  453.  
  454. /* Messages available in Mac OS 8.5 and later*/
  455.  
  456. enum {
  457.     kWindowMsgDragHilite        = 9,                            /* parameter boolean indicating on or off*/
  458.     kWindowMsgModified            = 10,                            /* parameter boolean indicating saved (false) or modified (true)*/
  459.     kWindowMsgDrawInCurrentPort    = 11,                            /* same as kWindowMsgDraw, but must draw in current port*/
  460.     kWindowMsgSetupProxyDragImage = 12,                            /* parameter pointer to SetupWindowProxyDragImageRec*/
  461.     kWindowMsgStateChanged        = 13,                            /* something about the window's state has changed*/
  462.     kWindowMsgMeasureTitle        = 14                            /* measure and return the ideal title width*/
  463. };
  464.  
  465. /* old names*/
  466.  
  467. enum {
  468.     wDraw                        = 0,
  469.     wHit                        = 1,
  470.     wCalcRgns                    = 2,
  471.     wNew                        = 3,
  472.     wDispose                    = 4,
  473.     wGrow                        = 5,
  474.     wDrawGIcon                    = 6
  475. };
  476.  
  477. /*——————————————————————————————————————————————————————————————————————————————————————*/
  478. /* • State-changed Flags for kWindowMsgStateChanged (Mac OS 8.5 and later)                */
  479. /*——————————————————————————————————————————————————————————————————————————————————————*/
  480.  
  481. enum {
  482.     kWindowStateTitleChanged    = (1 << 0),
  483.     kWindowStateSizeChanged        = (1 << 1),
  484.     kWindowStatePositionChanged    = (1 << 2),
  485.     kWindowStateZOrderChanged    = (1 << 3),
  486.     kWindowStateVisibilityChanged = (1 << 4),
  487.     kWindowStateHiliteChanged    = (1 << 5),
  488.     kWindowStateCollapseChanged    = (1 << 6)
  489. };
  490.  
  491.  
  492. /*——————————————————————————————————————————————————————————————————————————————————————*/
  493. /* • Window Feature Bits                                                                */
  494. /*——————————————————————————————————————————————————————————————————————————————————————*/
  495.  
  496. enum {
  497.     kWindowCanGrow                = (1 << 0),
  498.     kWindowCanZoom                = (1 << 1),
  499.     kWindowCanCollapse            = (1 << 2),
  500.     kWindowIsModal                = (1 << 3),
  501.     kWindowCanGetWindowRegion    = (1 << 4),
  502.     kWindowIsAlert                = (1 << 5),
  503.     kWindowHasTitleBar            = (1 << 6)
  504. };
  505.  
  506. /* Message bits available in Mac OS 8.5 and later*/
  507.  
  508. enum {
  509.     kWindowSupportsDragHilite    = (1 << 7),                        /* window definition supports kWindowMsgDragHilite*/
  510.     kWindowSupportsModifiedBit    = (1 << 8),                        /* window definition supports kWindowMsgModified*/
  511.     kWindowCanDrawInCurrentPort    = (1 << 9),                        /* window definition supports kWindowMsgDrawInCurrentPort*/
  512.     kWindowCanSetupProxyDragImage = (1 << 10),                    /* window definition supports kWindowMsgSetupProxyDragImage*/
  513.     kWindowCanMeasureTitle        = (1 << 11),                    /* window definition supports kWindowMsgMeasureTitle*/
  514.     kWindowWantsDisposeAtProcessDeath = (1 << 12)                /* window definition wants a Dispose message for windows still extant during ExitToShell*/
  515. };
  516.  
  517.  
  518. /*——————————————————————————————————————————————————————————————————————————————————————*/
  519. /* • Desktop Pattern Resource ID                                                        */
  520. /*——————————————————————————————————————————————————————————————————————————————————————*/
  521.  
  522. enum {
  523.     deskPatID                    = 16
  524. };
  525.  
  526.  
  527.  
  528. /*——————————————————————————————————————————————————————————————————————————————————————*/
  529. /* • Window Color Part Codes                                                            */
  530. /*——————————————————————————————————————————————————————————————————————————————————————*/
  531.  
  532. enum {
  533.     wContentColor                = 0,
  534.     wFrameColor                    = 1,
  535.     wTextColor                    = 2,
  536.     wHiliteColor                = 3,
  537.     wTitleBarColor                = 4
  538. };
  539.  
  540.  
  541. /*——————————————————————————————————————————————————————————————————————————————————————*/
  542. /*    • Region Dragging Constants                                                            */
  543. /*——————————————————————————————————————————————————————————————————————————————————————*/
  544.  
  545.  
  546. enum {
  547.     kMouseUpOutOfSlop            = (long)0x80008000
  548. };
  549.  
  550.  
  551. /*——————————————————————————————————————————————————————————————————————————————————————*/
  552. /* • Window Color Table                                                                    */
  553. /*——————————————————————————————————————————————————————————————————————————————————————*/
  554.  
  555. struct WinCTab {
  556.     long                             wCSeed;                        /* reserved */
  557.     short                             wCReserved;                    /* reserved */
  558.     short                             ctSize;                        /* usually 4 for windows */
  559.     ColorSpec                         ctTable[5];
  560. };
  561. typedef struct WinCTab                    WinCTab;
  562.  
  563. typedef WinCTab *                        WCTabPtr;
  564. typedef WCTabPtr *                        WCTabHandle;
  565. /*——————————————————————————————————————————————————————————————————————————————————————*/
  566. /* • WindowRecord                                                                        */
  567. /*——————————————————————————————————————————————————————————————————————————————————————*/
  568. typedef struct WindowRecord             WindowRecord;
  569. typedef WindowRecord *                    WindowPeek;
  570.  
  571. struct WindowRecord {
  572.     GrafPort                         port;
  573.     short                             windowKind;
  574.     Boolean                         visible;
  575.     Boolean                         hilited;
  576.     Boolean                         goAwayFlag;
  577.     Boolean                         spareFlag;
  578.     RgnHandle                         strucRgn;
  579.     RgnHandle                         contRgn;
  580.     RgnHandle                         updateRgn;
  581.     Handle                             windowDefProc;
  582.     Handle                             dataHandle;
  583.     StringHandle                     titleHandle;
  584.     short                             titleWidth;
  585.     Handle                             controlList;
  586.     WindowPeek                         nextWindow;
  587.     PicHandle                         windowPic;
  588.     long                             refCon;
  589. };
  590.  
  591. /*——————————————————————————————————————————————————————————————————————————————————————*/
  592. /* • Color WindowRecord                                                                    */
  593. /*——————————————————————————————————————————————————————————————————————————————————————*/
  594. typedef struct CWindowRecord             CWindowRecord;
  595. typedef CWindowRecord *                    CWindowPeek;
  596.  
  597. struct CWindowRecord {
  598.     CGrafPort                         port;
  599.     short                             windowKind;
  600.     Boolean                         visible;
  601.     Boolean                         hilited;
  602.     Boolean                         goAwayFlag;
  603.     Boolean                         spareFlag;
  604.     RgnHandle                         strucRgn;
  605.     RgnHandle                         contRgn;
  606.     RgnHandle                         updateRgn;
  607.     Handle                             windowDefProc;
  608.     Handle                             dataHandle;
  609.     StringHandle                     titleHandle;
  610.     short                             titleWidth;
  611.     Handle                             controlList;
  612.     CWindowPeek                     nextWindow;
  613.     PicHandle                         windowPic;
  614.     long                             refCon;
  615. };
  616.  
  617. /*——————————————————————————————————————————————————————————————————————————————————————*/
  618. /* • AuxWinHandle                                                                        */
  619. /*——————————————————————————————————————————————————————————————————————————————————————*/
  620. typedef struct AuxWinRec                 AuxWinRec;
  621. typedef AuxWinRec *                        AuxWinPtr;
  622. typedef AuxWinPtr *                        AuxWinHandle;
  623.  
  624. struct AuxWinRec {
  625.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  626.     WindowPtr                         awOwner;                    /*ptr to window */
  627.     CTabHandle                         awCTable;                    /*color table for this window*/
  628.     Handle                             reserved;
  629.     long                             awFlags;                    /*reserved for expansion*/
  630.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  631.     long                             awRefCon;                    /*user Constant*/
  632. };
  633.  
  634. /*——————————————————————————————————————————————————————————————————————————————————————*/
  635. /*    • BasicWindowDescription    (Mac OS 8.5 and later)                                    */
  636. /*                                                                                        */
  637. /*    Contains statically-sized basic attributes of the window, for storage in a            */
  638. /*    collection item.                                                                    */
  639. /*——————————————————————————————————————————————————————————————————————————————————————*/
  640. /* constants for the version field*/
  641.  
  642. enum {
  643.     kWindowDefinitionVersionOne    = 1,
  644.     kWindowDefinitionVersionTwo    = 2
  645. };
  646.  
  647. /* constants for the stateflags bit field */
  648.  
  649. enum {
  650.     kWindowIsCollapsedState        = (1 << 0L)
  651. };
  652.  
  653.  
  654. struct BasicWindowDescription {
  655.     UInt32                             descriptionSize;            /* sizeof(BasicWindowDescription)*/
  656.  
  657.     Rect                             windowContentRect;            /* location on screen*/
  658.     Rect                             windowZoomRect;                /* location on screen when zoomed out*/
  659.     UInt32                             windowRefCon;                /* the refcon - __avoid saving stale pointers here__    */
  660.     UInt32                             windowStateFlags;            /* flags indicating status of transient window state*/
  661.     WindowPositionMethod             windowPositionMethod;        /* method last used by RepositionWindow to position the window (if any)*/
  662.  
  663.     UInt32                             windowDefinitionVersion;
  664.     union {
  665.         struct {
  666.             SInt16                             windowDefProc;        /* defProc and variant*/
  667.             Boolean                         windowHasCloseBox;
  668.         }                                 versionOne;
  669.  
  670.         struct {
  671.             WindowClass                     windowClass;        /* the class*/
  672.             WindowAttributes                 windowAttributes;    /* the attributes*/
  673.         }                                 versionTwo;
  674.  
  675.     }                                 windowDefinition;
  676. };
  677. typedef struct BasicWindowDescription    BasicWindowDescription;
  678. /*  the window manager stores the default collection items using these IDs*/
  679.  
  680. enum {
  681.     kStoredWindowSystemTag        = FOUR_CHAR_CODE('appl'),        /* Only Apple collection items will be of this tag*/
  682.     kStoredBasicWindowDescriptionID = FOUR_CHAR_CODE('sbas'),    /* BasicWindowDescription*/
  683.     kStoredWindowPascalTitleID    = FOUR_CHAR_CODE('s255')        /* pascal title string*/
  684. };
  685.  
  686. /*——————————————————————————————————————————————————————————————————————————————————————*/
  687. /* • Window Class Ordering                                                                */
  688. /*                                                                                        */
  689. /*    Special cases for the “behind” parameter in window creation calls.                    */
  690. /*——————————————————————————————————————————————————————————————————————————————————————*/
  691. #define kFirstWindowOfClass ((WindowPtr)-1L)
  692. #define kLastWindowOfClass ((WindowPtr)0L)
  693. /*——————————————————————————————————————————————————————————————————————————————————————*/
  694. /* • Zoom Information Handle                                                             */
  695. /*——————————————————————————————————————————————————————————————————————————————————————*/
  696.  
  697. struct WStateData {
  698.     Rect                             userState;                    /*user zoom state*/
  699.     Rect                             stdState;                    /*standard zoom state*/
  700. };
  701. typedef struct WStateData                WStateData;
  702. typedef WStateData *                    WStateDataPtr;
  703. typedef WStateDataPtr *                    WStateDataHandle;
  704. /*——————————————————————————————————————————————————————————————————————————————————————*/
  705. /* • Window Creation & Persistence                                                        */
  706. /*——————————————————————————————————————————————————————————————————————————————————————*/
  707. EXTERN_API( WindowPtr )
  708. GetNewCWindow                    (short                     windowID,
  709.                                  void *                    wStorage,
  710.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xAA46);
  711.  
  712. EXTERN_API( WindowPtr )
  713. NewWindow                        (void *                    wStorage,
  714.                                  const Rect *            boundsRect,
  715.                                  ConstStr255Param         title,
  716.                                  Boolean                 visible,
  717.                                  short                     theProc,
  718.                                  WindowPtr                 behind,
  719.                                  Boolean                 goAwayFlag,
  720.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  721.  
  722. EXTERN_API( WindowPtr )
  723. GetNewWindow                    (short                     windowID,
  724.                                  void *                    wStorage,
  725.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA9BD);
  726.  
  727. EXTERN_API( WindowPtr )
  728. NewCWindow                        (void *                    wStorage,
  729.                                  const Rect *            boundsRect,
  730.                                  ConstStr255Param         title,
  731.                                  Boolean                 visible,
  732.                                  short                     procID,
  733.                                  WindowPtr                 behind,
  734.                                  Boolean                 goAwayFlag,
  735.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  736.  
  737. EXTERN_API( void )
  738. DisposeWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA914);
  739.  
  740. #if TARGET_OS_MAC
  741.     #define MacCloseWindow CloseWindow
  742. #endif
  743. EXTERN_API( void )
  744. MacCloseWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA92D);
  745.  
  746.  
  747. /* Routines available in Mac OS 8.5 and later*/
  748.  
  749. EXTERN_API( OSStatus )
  750. CreateNewWindow                    (WindowClass             windowClass,
  751.                                  WindowAttributes         attributes,
  752.                                  const Rect *            bounds,
  753.                                  WindowPtr *            outWindow);
  754.  
  755. /* Create a window from a ‘wind’ resource*/
  756. EXTERN_API( OSStatus )
  757. CreateWindowFromResource        (SInt16                 resID,
  758.                                  WindowPtr *            outWindow);
  759.  
  760. /* window persistence*/
  761. EXTERN_API( OSStatus )
  762. StoreWindowIntoCollection        (WindowPtr                 window,
  763.                                  Collection             collection);
  764.  
  765. EXTERN_API( OSStatus )
  766. CreateWindowFromCollection        (Collection             collection,
  767.                                  WindowPtr *            outWindow);
  768.  
  769. /* window refcounting*/
  770. EXTERN_API( OSStatus )
  771. GetWindowOwnerCount                (WindowPtr                 window,
  772.                                  UInt32 *                outCount);
  773.  
  774. EXTERN_API( OSStatus )
  775. CloneWindow                        (WindowPtr                 window);
  776.  
  777.  
  778. /*——————————————————————————————————————————————————————————————————————————————————————*/
  779. /* • Window Class Accessors (Mac OS 8.5 and later)                                        */
  780. /*——————————————————————————————————————————————————————————————————————————————————————*/
  781. EXTERN_API( OSStatus )
  782. GetWindowClass                    (WindowPtr                 window,
  783.                                  WindowClass *            outClass);
  784.  
  785. EXTERN_API( OSStatus )
  786. GetWindowAttributes                (WindowPtr                 window,
  787.                                  WindowAttributes *        outAttributes);
  788.  
  789.  
  790. /*——————————————————————————————————————————————————————————————————————————————————————*/
  791. /* • Floating Windows (Mac OS 8.5 and later)                                            */
  792. /*——————————————————————————————————————————————————————————————————————————————————————*/
  793. EXTERN_API( OSStatus )
  794. ShowFloatingWindows                (void);
  795.  
  796. EXTERN_API( OSStatus )
  797. HideFloatingWindows                (void);
  798.  
  799. EXTERN_API( Boolean )
  800. AreFloatingWindowsVisible        (void);
  801.  
  802. EXTERN_API( WindowPtr )
  803. FrontNonFloatingWindow            (void);
  804.  
  805.  
  806.  
  807. /*——————————————————————————————————————————————————————————————————————————————————————*/
  808. /* • Background Imaging                                                                    */
  809. /*——————————————————————————————————————————————————————————————————————————————————————*/
  810. EXTERN_API( void )
  811. SetWinColor                        (WindowPtr                 window,
  812.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  813.  
  814. EXTERN_API( void )
  815. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  816.  
  817. /* Routines available in Mac OS 8.5 and later*/
  818.  
  819. EXTERN_API( OSStatus )
  820. SetWindowContentColor            (WindowPtr                 window,
  821.                                  RGBColor *                color);
  822.  
  823. EXTERN_API( OSStatus )
  824. GetWindowContentColor            (WindowPtr                 window,
  825.                                  RGBColor *                color);
  826.  
  827. EXTERN_API( OSStatus )
  828. GetWindowContentPattern            (WindowPtr                 window,
  829.                                  PixPatHandle             outPixPat);
  830.  
  831. EXTERN_API( OSStatus )
  832. SetWindowContentPattern            (WindowPtr                 window,
  833.                                  PixPatHandle             pixPat);
  834.  
  835.  
  836.  
  837. /*——————————————————————————————————————————————————————————————————————————————————————*/
  838. /* • Low-Level Region & Painting Routines                                                */
  839. /*——————————————————————————————————————————————————————————————————————————————————————*/
  840. EXTERN_API( void )
  841. ClipAbove                        (WindowPtr                 window)                                ONEWORDINLINE(0xA90B);
  842.  
  843. EXTERN_API( void )
  844. SaveOld                            (WindowPtr                 window)                                ONEWORDINLINE(0xA90E);
  845.  
  846. EXTERN_API( void )
  847. DrawNew                            (WindowPtr                 window,
  848.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  849.  
  850. EXTERN_API( void )
  851. PaintOne                        (WindowPtr                 window,
  852.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  853.  
  854. EXTERN_API( void )
  855. PaintBehind                        (WindowPtr                 startWindow,
  856.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  857.  
  858. EXTERN_API( void )
  859. CalcVis                            (WindowPtr                 window)                                ONEWORDINLINE(0xA909);
  860.  
  861. EXTERN_API( void )
  862. CalcVisBehind                    (WindowPtr                 startWindow,
  863.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  864.  
  865. EXTERN_API( Boolean )
  866. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  867.  
  868.  
  869. /*——————————————————————————————————————————————————————————————————————————————————————*/
  870. /* • Window List                                                                        */
  871. /*——————————————————————————————————————————————————————————————————————————————————————*/
  872. #if TARGET_OS_MAC
  873.     #define MacFindWindow FindWindow
  874. #endif
  875. EXTERN_API( short )
  876. MacFindWindow                    (Point                     thePoint,
  877.                                  WindowPtr *            window)                                ONEWORDINLINE(0xA92C);
  878.  
  879. EXTERN_API( WindowPtr )
  880. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  881.  
  882. EXTERN_API( void )
  883. BringToFront                    (WindowPtr                 window)                                ONEWORDINLINE(0xA920);
  884.  
  885. EXTERN_API( void )
  886. SendBehind                        (WindowPtr                 window,
  887.                                  WindowPtr                 behindWindow)                        ONEWORDINLINE(0xA921);
  888.  
  889. EXTERN_API( void )
  890. SelectWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA91F);
  891.  
  892.  
  893. /*——————————————————————————————————————————————————————————————————————————————————————*/
  894. /* • Misc Low-Level stuff                                                                */
  895. /*——————————————————————————————————————————————————————————————————————————————————————*/
  896. EXTERN_API( void )
  897. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  898.  
  899. EXTERN_API( void )
  900. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  901.  
  902. EXTERN_API( void )
  903. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  904.  
  905. /* Routines available in Mac OS 8.5 and later*/
  906.  
  907. EXTERN_API( Boolean )
  908. IsValidWindowPtr                (GrafPtr                 grafPort);
  909.  
  910. EXTERN_API( OSStatus )
  911. InitFloatingWindows                (void);
  912.  
  913.  
  914.  
  915. /*——————————————————————————————————————————————————————————————————————————————————————*/
  916. /* • Various & Sundry Window Accessors                                                    */
  917. /*——————————————————————————————————————————————————————————————————————————————————————*/
  918. EXTERN_API( void )
  919. HiliteWindow                    (WindowPtr                 window,
  920.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  921.  
  922. EXTERN_API( void )
  923. SetWRefCon                        (WindowPtr                 window,
  924.                                  long                     data)                                ONEWORDINLINE(0xA918);
  925.  
  926. EXTERN_API( long )
  927. GetWRefCon                        (WindowPtr                 window)                                ONEWORDINLINE(0xA917);
  928.  
  929. EXTERN_API( void )
  930. SetWindowPic                    (WindowPtr                 window,
  931.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  932.  
  933. EXTERN_API( PicHandle )
  934. GetWindowPic                    (WindowPtr                 window)                                ONEWORDINLINE(0xA92F);
  935.  
  936. EXTERN_API( short )
  937. GetWVariant                        (WindowPtr                 window)                                ONEWORDINLINE(0xA80A);
  938.  
  939. /* Routines available in Mac OS 8.0 (Appearance 1.0) and later*/
  940. EXTERN_API( OSStatus )
  941. GetWindowFeatures                (WindowPtr                 window,
  942.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA74);
  943.  
  944. EXTERN_API( OSStatus )
  945. GetWindowRegion                    (WindowPtr                 window,
  946.                                  WindowRegionCode         inRegionCode,
  947.                                  RgnHandle                 ioWinRgn)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA74);
  948.  
  949.  
  950.  
  951. /*——————————————————————————————————————————————————————————————————————————————————————*/
  952. /* • Update Events                                                                        */
  953. /*——————————————————————————————————————————————————————————————————————————————————————*/
  954.  
  955. EXTERN_API( void )
  956. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  957.  
  958. EXTERN_API( void )
  959. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  960.  
  961. EXTERN_API( void )
  962. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  963.  
  964. EXTERN_API( void )
  965. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  966.  
  967. EXTERN_API( void )
  968. BeginUpdate                        (WindowPtr                 window)                                ONEWORDINLINE(0xA922);
  969.  
  970. EXTERN_API( void )
  971. EndUpdate                        (WindowPtr                 window)                                ONEWORDINLINE(0xA923);
  972.  
  973. /* Routines available in Mac OS 8.5 and later*/
  974. EXTERN_API( OSStatus )
  975. InvalWindowRgn                    (WindowPtr                 window,
  976.                                  RgnHandle                 region);
  977.  
  978. EXTERN_API( OSStatus )
  979. InvalWindowRect                    (WindowPtr                 window,
  980.                                  const Rect *            bounds);
  981.  
  982. EXTERN_API( OSStatus )
  983. ValidWindowRgn                    (WindowPtr                 window,
  984.                                  RgnHandle                 region);
  985.  
  986. EXTERN_API( OSStatus )
  987. ValidWindowRect                    (WindowPtr                 window,
  988.                                  const Rect *            bounds);
  989.  
  990.  
  991. /*——————————————————————————————————————————————————————————————————————————————————————*/
  992. /* • DrawGrowIcon                                                                        */
  993. /*                                                                                        */
  994. /*    DrawGrowIcon is deprecated in Mac OS 8.0 and later.  Theme-savvy window defprocs    */
  995. /*    include the grow box in the window frame automatically.                                */
  996. /*——————————————————————————————————————————————————————————————————————————————————————*/
  997. EXTERN_API( void )
  998. DrawGrowIcon                    (WindowPtr                 window)                                ONEWORDINLINE(0xA904);
  999.  
  1000. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1001. /* • Window Titles                                                                        */
  1002. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1003. EXTERN_API( void )
  1004. SetWTitle                        (WindowPtr                 window,
  1005.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  1006.  
  1007. EXTERN_API( void )
  1008. GetWTitle                        (WindowPtr                 window,
  1009.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  1010.  
  1011. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1012. /* • Window Proxies (Mac OS 8.5 and later)                                                */
  1013. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1014. EXTERN_API( OSStatus )
  1015. SetWindowProxyFSSpec            (WindowPtr                 window,
  1016.                                  const FSSpec *            inFile);
  1017.  
  1018. EXTERN_API( OSStatus )
  1019. GetWindowProxyFSSpec            (WindowPtr                 window,
  1020.                                  FSSpec *                outFile);
  1021.  
  1022. EXTERN_API( OSStatus )
  1023. SetWindowProxyAlias                (WindowPtr                 window,
  1024.                                  AliasHandle             alias);
  1025.  
  1026. EXTERN_API( OSStatus )
  1027. GetWindowProxyAlias                (WindowPtr                 window,
  1028.                                  AliasHandle *            alias);
  1029.  
  1030. EXTERN_API( OSStatus )
  1031. SetWindowProxyCreatorAndType    (WindowPtr                 window,
  1032.                                  OSType                 fileCreator,
  1033.                                  OSType                 fileType,
  1034.                                  SInt16                 vRefNum);
  1035.  
  1036. EXTERN_API( OSStatus )
  1037. GetWindowProxyIcon                (WindowPtr                 window,
  1038.                                  IconRef *                outIcon);
  1039.  
  1040. EXTERN_API( OSStatus )
  1041. SetWindowProxyIcon                (WindowPtr                 window,
  1042.                                  IconRef                 icon);
  1043.  
  1044. EXTERN_API( OSStatus )
  1045. RemoveWindowProxy                (WindowPtr                 window);
  1046.  
  1047. EXTERN_API( OSStatus )
  1048. BeginWindowProxyDrag            (WindowPtr                 window,
  1049.                                  DragReference *        outNewDrag,
  1050.                                  RgnHandle                 outDragOutlineRgn);
  1051.  
  1052. EXTERN_API( OSStatus )
  1053. EndWindowProxyDrag                (WindowPtr                 window,
  1054.                                  DragReference             theDrag);
  1055.  
  1056. EXTERN_API( OSStatus )
  1057. TrackWindowProxyFromExistingDrag (WindowPtr             window,
  1058.                                  Point                     startPt,
  1059.                                  DragReference             drag,
  1060.                                  RgnHandle                 inDragOutlineRgn);
  1061.  
  1062. EXTERN_API( OSStatus )
  1063. TrackWindowProxyDrag            (WindowPtr                 window,
  1064.                                  Point                     startPt);
  1065.  
  1066. EXTERN_API( Boolean )
  1067. IsWindowModified                (WindowPtr                 window);
  1068.  
  1069. EXTERN_API( OSStatus )
  1070. SetWindowModified                (WindowPtr                 window,
  1071.                                  Boolean                 modified);
  1072.  
  1073. EXTERN_API( Boolean )
  1074. IsWindowPathSelectClick            (WindowPtr                 window,
  1075.                                  EventRecord *            event);
  1076.  
  1077. EXTERN_API( OSStatus )
  1078. WindowPathSelect                (WindowPtr                 window,
  1079.                                  MenuHandle             menu, /* can be NULL */
  1080.                                  SInt32 *                outMenuResult);
  1081.  
  1082.  
  1083. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1084. /*    • HiliteWindowFrameForDrag    (Mac OS 8.5 and later)                                    */
  1085. /*                                                                                        */
  1086. /*    If you call ShowDragHilite and HideDragHilite, you don’t need to use this routine.    */
  1087. /*    If you implement custom drag hiliting, you should call HiliteWindowFrameForDrag        */
  1088. /*    when the drag is tracking inside a window with drag-hilited content.                */
  1089. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1090. EXTERN_API( OSStatus )
  1091. HiliteWindowFrameForDrag        (WindowPtr                 window,
  1092.                                  Boolean                 hilited)                            TWOWORDINLINE(0x7019, 0xA829);
  1093.  
  1094.  
  1095. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1096. /* • Window Transitions    (Mac OS 8.5 and later)                                            */
  1097. /*                                                                                         */
  1098. /*     TransitionWindow displays a window with accompanying animation and sound.            */
  1099. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1100.  
  1101. typedef UInt32                             WindowTransitionEffect;
  1102.  
  1103. enum {
  1104.     kWindowZoomTransitionEffect    = 1                                /* Finder-like zoom rectangles, use with Show or Open transition actions*/
  1105. };
  1106.  
  1107. typedef UInt32                             WindowTransitionAction;
  1108.  
  1109. enum {
  1110.     kWindowShowTransitionAction    = 1,                            /* param is rect in global coordinates from which to start the animation*/
  1111.     kWindowHideTransitionAction    = 2                                /* param is rect in global coordinates at which to end the animation*/
  1112. };
  1113.  
  1114. EXTERN_API( OSStatus )
  1115. TransitionWindow                (WindowPtr                 window,
  1116.                                  WindowTransitionEffect  effect,
  1117.                                  WindowTransitionAction  action,
  1118.                                  const Rect *            rect) /* can be NULL */;
  1119.  
  1120.  
  1121. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1122. /* • Window Positioning                                                                    */
  1123. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1124.  
  1125. #if TARGET_OS_MAC
  1126.     #define MacMoveWindow MoveWindow
  1127. #endif
  1128. EXTERN_API( void )
  1129. MacMoveWindow                    (WindowPtr                 window,
  1130.                                  short                     hGlobal,
  1131.                                  short                     vGlobal,
  1132.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  1133.  
  1134. EXTERN_API( void )
  1135. SizeWindow                        (WindowPtr                 window,
  1136.                                  short                     w,
  1137.                                  short                     h,
  1138.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  1139.  
  1140. EXTERN_API( long )
  1141. GrowWindow                        (WindowPtr                 window,
  1142.                                  Point                     startPt,
  1143.                                  const Rect *            bBox)                                ONEWORDINLINE(0xA92B);
  1144.  
  1145. EXTERN_API( void )
  1146. DragWindow                        (WindowPtr                 window,
  1147.                                  Point                     startPt,
  1148.                                  const Rect *            boundsRect)                            ONEWORDINLINE(0xA925);
  1149.  
  1150. EXTERN_API( void )
  1151. ZoomWindow                        (WindowPtr                 window,
  1152.                                  short                     partCode,
  1153.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  1154.  
  1155. /* Routines available in Mac OS 8.0 (Appearance 1.0) and later*/
  1156.  
  1157. EXTERN_API( Boolean )
  1158. IsWindowCollapsable                (WindowPtr                 window)                                THREEWORDINLINE(0x303C, 0x000F, 0xAA74);
  1159.  
  1160. EXTERN_API( Boolean )
  1161. IsWindowCollapsed                (WindowPtr                 window)                                THREEWORDINLINE(0x303C, 0x0010, 0xAA74);
  1162.  
  1163. EXTERN_API( OSStatus )
  1164. CollapseWindow                    (WindowPtr                 window,
  1165.                                  Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0011, 0xAA74);
  1166.  
  1167. EXTERN_API( OSStatus )
  1168. CollapseAllWindows                (Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0012, 0xAA74);
  1169.  
  1170. /* Routines available in Mac OS 8.5 and later*/
  1171.  
  1172. EXTERN_API( OSStatus )
  1173. RepositionWindow                (WindowPtr                 window,
  1174.                                  WindowPtr                 parentWindow,
  1175.                                  WindowPositionMethod     method);
  1176.  
  1177. EXTERN_API( OSStatus )
  1178. SetWindowBounds                    (WindowPtr                 window,
  1179.                                  WindowRegionCode         regionCode,
  1180.                                  const Rect *            globalBounds);
  1181.  
  1182. EXTERN_API( OSStatus )
  1183. GetWindowBounds                    (WindowPtr                 window,
  1184.                                  WindowRegionCode         regionCode,
  1185.                                  Rect *                    globalBounds);
  1186.  
  1187. EXTERN_API( OSStatus )
  1188. MoveWindowStructure                (WindowPtr                 window,
  1189.                                  short                     hGlobal,
  1190.                                  short                     vGlobal);
  1191.  
  1192. EXTERN_API( Boolean )
  1193. ResizeWindow                    (WindowPtr                 window,
  1194.                                  Point                     startPoint,
  1195.                                  const Rect *            sizeConstraints, /* can be NULL */
  1196.                                  Rect *                    newContentRect);
  1197.  
  1198. EXTERN_API( Boolean )
  1199. IsWindowInStandardState            (WindowPtr                 window,
  1200.                                  Point *                idealSize,
  1201.                                  Rect *                    idealStandardState);
  1202.  
  1203. EXTERN_API( OSStatus )
  1204. ZoomWindowIdeal                    (WindowPtr                 window,
  1205.                                  SInt16                 partCode,
  1206.                                  Point *                ioIdealSize);
  1207.  
  1208. EXTERN_API( OSStatus )
  1209. GetWindowIdealUserState            (WindowPtr                 window,
  1210.                                  Rect *                    userState);
  1211.  
  1212. EXTERN_API( OSStatus )
  1213. SetWindowIdealUserState            (WindowPtr                 window,
  1214.                                  Rect *                    userState);
  1215.  
  1216.  
  1217. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1218. /* • Window Visibility                                                                    */
  1219. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1220.  
  1221. EXTERN_API( void )
  1222. HideWindow                        (WindowPtr                 window)                                ONEWORDINLINE(0xA916);
  1223.  
  1224. #if TARGET_OS_MAC
  1225.     #define MacShowWindow ShowWindow
  1226. #endif
  1227. EXTERN_API( void )
  1228. MacShowWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA915);
  1229.  
  1230. EXTERN_API( void )
  1231. ShowHide                        (WindowPtr                 window,
  1232.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  1233.  
  1234.  
  1235. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1236. /* • Window Properties (Mac OS 8.5 and later)                                            */
  1237. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1238.  
  1239. EXTERN_API( OSStatus )
  1240. GetWindowProperty                (WindowPtr                 window,
  1241.                                  PropertyCreator         propertyCreator,
  1242.                                  PropertyTag             propertyTag,
  1243.                                  UInt32                 bufferSize,
  1244.                                  UInt32 *                actualSize, /* can be NULL */
  1245.                                  void *                    propertyBuffer);
  1246.  
  1247. EXTERN_API( OSStatus )
  1248. GetWindowPropertySize            (WindowPtr                 window,
  1249.                                  PropertyCreator         creator,
  1250.                                  PropertyTag             tag,
  1251.                                  UInt32 *                size);
  1252.  
  1253. EXTERN_API( OSStatus )
  1254. SetWindowProperty                (WindowPtr                 window,
  1255.                                  PropertyCreator         propertyCreator,
  1256.                                  PropertyTag             propertyTag,
  1257.                                  UInt32                 propertySize,
  1258.                                  void *                    propertyBuffer);
  1259.  
  1260. EXTERN_API( OSStatus )
  1261. RemoveWindowProperty            (WindowPtr                 window,
  1262.                                  PropertyCreator         propertyCreator,
  1263.                                  PropertyTag             propertyTag);
  1264.  
  1265. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1266. /* • Utilities                                                                            */
  1267. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1268. EXTERN_API( long )
  1269. PinRect                            (const Rect *            theRect,
  1270.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  1271.  
  1272.  
  1273. EXTERN_API( RgnHandle )
  1274. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  1275.  
  1276.  
  1277. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1278. /* • Window Part Tracking                                                                */
  1279. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1280. EXTERN_API( Boolean )
  1281. TrackBox                        (WindowPtr                 window,
  1282.                                  Point                     thePt,
  1283.                                  short                     partCode)                            ONEWORDINLINE(0xA83B);
  1284.  
  1285. EXTERN_API( Boolean )
  1286. TrackGoAway                        (WindowPtr                 window,
  1287.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  1288.  
  1289.  
  1290. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1291. /* • Region Dragging                                                                    */
  1292. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1293. EXTERN_API( long )
  1294. DragGrayRgn                        (RgnHandle                 theRgn,
  1295.                                  Point                     startPt,
  1296.                                  const Rect *            limitRect,
  1297.                                  const Rect *            slopRect,
  1298.                                  short                     axis,
  1299.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  1300.  
  1301. EXTERN_API( long )
  1302. DragTheRgn                        (RgnHandle                 theRgn,
  1303.                                  Point                     startPt,
  1304.                                  const Rect *            limitRect,
  1305.                                  const Rect *            slopRect,
  1306.                                  short                     axis,
  1307.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  1308.  
  1309.  
  1310. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1311. /*    • GetAuxWin                                                                            */
  1312. /*                                                                                        */
  1313. /*    Avoid using GetAuxWin if at all possible                                            */
  1314. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1315. EXTERN_API( Boolean )
  1316. GetAuxWin                        (WindowPtr                 window,
  1317.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  1318.  
  1319. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1320. /* • MixedMode & ProcPtrs                                                                */
  1321. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1322. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowPtr window, short message, long param);
  1323. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  1324. /*
  1325.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  1326.              and cannot be written in a high-level language without 
  1327.              the help of mixed mode or assembly glue.
  1328. */
  1329. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  1330. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  1331. enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  1332. enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  1333. #define NewWindowDefProc(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  1334. #define NewDeskHookProc(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  1335. #define CallWindowDefProc(userRoutine, varCode, window, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppWindowDefProcInfo, (varCode), (window), (message), (param))
  1336. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1337.     #pragma parameter CallDeskHookProc(__A1, __D0, __A0)
  1338.     void CallDeskHookProc(DeskHookUPP routine, Boolean mouseClick, EventRecord * theEvent) = 0x4E91;
  1339. #else
  1340.     #define CallDeskHookProc(userRoutine, mouseClick, theEvent)  CALL_TWO_PARAMETER_UPP((userRoutine), uppDeskHookProcInfo, (mouseClick), (theEvent))
  1341. #endif
  1342. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1343. /* • C Glue                                                                                */
  1344. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1345. #if CGLUESUPPORTED
  1346. EXTERN_API_C( void )
  1347. setwtitle                        (WindowPtr                 window,
  1348.                                  const char *            title);
  1349.  
  1350. EXTERN_API_C( Boolean )
  1351. trackgoaway                        (WindowPtr                 window,
  1352.                                  Point *                thePt);
  1353.  
  1354. EXTERN_API_C( short )
  1355. findwindow                        (Point *                thePoint,
  1356.                                  WindowPtr *            window);
  1357.  
  1358. EXTERN_API_C( void )
  1359. getwtitle                        (WindowPtr                 window,
  1360.                                  char *                    title);
  1361.  
  1362. EXTERN_API_C( long )
  1363. growwindow                        (WindowPtr                 window,
  1364.                                  Point *                startPt,
  1365.                                  const Rect *            bBox);
  1366.  
  1367. EXTERN_API_C( WindowPtr )
  1368. newwindow                        (void *                    wStorage,
  1369.                                  const Rect *            boundsRect,
  1370.                                  const char *            title,
  1371.                                  Boolean                 visible,
  1372.                                  short                     theProc,
  1373.                                  WindowPtr                 behind,
  1374.                                  Boolean                 goAwayFlag,
  1375.                                  long                     refCon);
  1376.  
  1377. EXTERN_API_C( WindowPtr )
  1378. newcwindow                        (void *                    wStorage,
  1379.                                  const Rect *            boundsRect,
  1380.                                  const char *            title,
  1381.                                  Boolean                 visible,
  1382.                                  short                     procID,
  1383.                                  WindowPtr                 behind,
  1384.                                  Boolean                 goAwayFlag,
  1385.                                  long                     refCon);
  1386.  
  1387. EXTERN_API_C( long )
  1388. pinrect                            (const Rect *            theRect,
  1389.                                  Point *                thePt);
  1390.  
  1391. EXTERN_API_C( Boolean )
  1392. trackbox                        (WindowPtr                 window,
  1393.                                  Point *                thePt,
  1394.                                  short                     partCode);
  1395.  
  1396. EXTERN_API_C( long )
  1397. draggrayrgn                        (RgnHandle                 theRgn,
  1398.                                  Point *                startPt,
  1399.                                  const Rect *            boundsRect,
  1400.                                  const Rect *            slopRect,
  1401.                                  short                     axis,
  1402.                                  DragGrayRgnUPP         actionProc);
  1403.  
  1404. EXTERN_API_C( void )
  1405. dragwindow                        (WindowPtr                 window,
  1406.                                  Point *                startPt,
  1407.                                  const Rect *            boundsRect);
  1408.  
  1409. #endif  /* CGLUESUPPORTED */
  1410.  
  1411. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1412. /* • WindowRecord accessor macros                                                        */
  1413. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1414. /*
  1415.     *****************************************************************************
  1416.     *                                                                           *
  1417.     * The conditional STRICT_WINDOWS has been removed from this interface file. *
  1418.     * The accessor macros to a WindowRecord are no longer necessary.            *
  1419.     *                                                                           *
  1420.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  1421.     *                                                                           *
  1422.     *****************************************************************************
  1423.  
  1424.     Details:
  1425.     The original purpose of the STRICT_ conditionals and accessor macros was to
  1426.     help ease the transition to Copland.  Shared data structures are difficult
  1427.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  1428.     WindowRecord and other data structures, we would begin the migration to the
  1429.     discipline wherein system data structures are completely hidden from
  1430.     applications.
  1431.     
  1432.     After many design reviews, we finally concluded that with this sort of
  1433.     migration, the system could never tell when an application was no longer
  1434.     peeking at a WindowRecord, and thus the data structure might never become
  1435.     system owned.  Additionally, there were many other limitations in the
  1436.     classic toolbox that were begging to be addressed.  The final decision was
  1437.     to leave the traditional toolbox as a compatibility mode.
  1438.     
  1439.     We also decided to use the Handle and Ptr based types in the function
  1440.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  1441.     WindowRef.  The Ref types are still defined in the header files, so all
  1442.     existing code will still compile exactly as it did before.  There are
  1443.     several reasons why we chose to do this:
  1444.     
  1445.     - The importance of backwards compatibility makes it unfeasible for us to
  1446.     enforce real opaque references in the implementation anytime in the
  1447.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  1448.     ControlRef, etc.) in the documentation and header files would always be a
  1449.     fake veneer of opacity.
  1450.     
  1451.     - There exists a significant base of books and sample code that neophyte
  1452.     Macintosh developers use to learn how to program the Macintosh.  These
  1453.     books and sample code all use direct data access.  Introducing opaque data
  1454.     types at this point would confuse neophyte programmers more than it would
  1455.     help them.
  1456.     
  1457.     - Direct data structure access is used by nearly all Macintosh developers. 
  1458.     Changing the interfaces to reflect a false opacity would not provide any
  1459.     benefit to these developers.
  1460.     
  1461.     - Accessor functions are useful in and of themselves as convenience
  1462.     functions.
  1463.     
  1464.     - Note: some accessor names conflict with API's in Win32 and have been renamed
  1465.     to have a Mac prefix (QuickTime 3.0).
  1466. */
  1467. #ifdef __cplusplus
  1468. inline CGrafPtr        GetWindowPort(WindowPtr w)                     { return (CGrafPtr) w;                                                     }
  1469. inline void            SetPortWindowPort(WindowPtr w)                { MacSetPort( (GrafPtr) GetWindowPort(w)); }
  1470. inline SInt16        GetWindowKind(WindowPtr w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  1471. inline void            SetWindowKind(WindowPtr    w, SInt16 wKind)    { *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  1472. #if TARGET_OS_MAC
  1473. inline Boolean        IsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1474. #endif
  1475. inline Boolean        MacIsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1476. inline Boolean        IsWindowHilited(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  1477. inline Boolean        GetWindowGoAwayFlag(WindowPtr w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  1478. inline Boolean        GetWindowZoomFlag(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  1479. inline void            GetWindowStructureRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  1480. inline void            GetWindowContentRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  1481. inline void            GetWindowUpdateRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  1482. inline SInt16        GetWindowTitleWidth(WindowPtr w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  1483. #if TARGET_OS_MAC
  1484. inline WindowPtr    GetNextWindow(WindowPtr w)                        { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1485. #endif
  1486. inline WindowPtr    MacGetNextWindow(WindowPtr w)                    { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1487.  
  1488. inline void    GetWindowStandardState(WindowPtr w, Rect *r)
  1489. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1490. if (stateRects != NULL)    *r = stateRects[1];        }
  1491. inline void    SetWindowStandardState(WindowPtr w, const Rect *r)
  1492. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1493.     if (stateRects != NULL)    stateRects[1] = *r;     }
  1494. inline void    GetWindowUserState(WindowPtr w, Rect *r)
  1495. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1496.     if (stateRects != NULL)    *r = stateRects[0]; }
  1497. inline void    SetWindowUserState(WindowPtr w, const Rect *r)
  1498. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1499.     if (stateRects != NULL)    stateRects[0] = *r; }
  1500. inline Handle        GetWindowDataHandle(WindowPtr w)                {    return    (((WindowPeek) (w))->dataHandle);                }
  1501. inline void            SetWindowDataHandle(WindowPtr w, Handle data)    {    (((WindowPeek) (w))->dataHandle) = ((Handle) (data));    }
  1502. #else
  1503. #if TARGET_OS_MAC
  1504. #define IsWindowVisible MacIsWindowVisible
  1505. #define GetNextWindow MacGetNextWindow
  1506. #endif
  1507. #define ShowHideWindow(w)                        ShowHide(w)
  1508. #define SetPortWindowPort(w)                    MacSetPort( (GrafPtr) GetWindowPort(w) )
  1509. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  1510. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  1511. #define SetWindowKind(w, wKind)                    ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  1512. #define MacIsWindowVisible(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  1513. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  1514. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  1515. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  1516. #define GetWindowStructureRgn(w, aRgnHandle)    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  1517. #define GetWindowContentRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  1518.  
  1519. #define GetWindowUpdateRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  1520.  
  1521. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  1522. #define MacGetNextWindow(w)                        ( *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  1523.  
  1524. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1525.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  1526. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1527.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  1528. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1529.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  1530. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1531.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  1532. #define GetWindowDataHandle(windowRef)                (((WindowPeek) (windowRef))->dataHandle)
  1533. #define SetWindowDataHandle(windowRef, data)        (((WindowPeek) (windowRef))->dataHandle) = ((Handle) (data))
  1534.  
  1535. #endif  /* defined(__cplusplus) */
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547. #if PRAGMA_STRUCT_ALIGN
  1548.     #pragma options align=reset
  1549. #elif PRAGMA_STRUCT_PACKPUSH
  1550.     #pragma pack(pop)
  1551. #elif PRAGMA_STRUCT_PACK
  1552.     #pragma pack()
  1553. #endif
  1554.  
  1555. #ifdef PRAGMA_IMPORT_OFF
  1556. #pragma import off
  1557. #elif PRAGMA_IMPORT
  1558. #pragma import reset
  1559. #endif
  1560.  
  1561. #ifdef __cplusplus
  1562. }
  1563. #endif
  1564.  
  1565. #endif /* __MACWINDOWS__ */
  1566.  
  1567.